home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / easyprocess / source / launch / checkalive.c next >
C/C++ Source or Header  |  1992-09-07  |  981b  |  54 lines

  1. #include <arpbase.h>
  2. #include <arp_proto.h>
  3. #include "Launch.h"
  4. #include "LaunchPriv.h"
  5.  
  6.  
  7. /*
  8.  *    NAME
  9.  *        CheckAlive -- check if the process is still alive.
  10.  *
  11.  *    SYNOPSIS
  12.  *        alive = CheckAlive (Proc)
  13.  *
  14.  *        BOOL CheckAlive (struct Process *);
  15.  *
  16.  *    DESCRIPTION
  17.  *        Scan the list of process pair for a pair whose child is the
  18.  *        process passed as input.  It then check if the entry point is
  19.  *        NULL, meaning the child is dead.
  20.  *
  21.  *    INPUT
  22.  *        Proc - the process who wants to find if it's alive.
  23.  *
  24.  *    OUTPUT
  25.  *        alive - non-null if the process is alive.
  26.  *
  27.  *    NOTE
  28.  *        This function can be used as a polling mecanism to find out
  29.  *        if the child still exists.
  30.  *
  31.  *    HISTORY
  32.  *        1992/09/06    Pierre Baillargeon        Creation
  33.  *
  34.  */
  35.  
  36. BOOL CheckAlive (struct Process *Proc)
  37. {
  38.     struct ProcPair *pp;
  39.     BOOL result;
  40.  
  41.     Forbid ();
  42.     if (NULL != ProcPairList && NULL != (pp = IsChild (Proc)))
  43.     {
  44.         result = (pp->pp_ChildEntry != NULL);
  45.     }
  46.     else
  47.     {
  48.         result = 0;
  49.     }
  50.     Permit ();
  51.  
  52.     return result;
  53. }
  54.